//
// Created by 11510 on 2024/7/19.
//

#ifndef DAY80_DEMO4_MAINWINDOW_H
#define DAY80_DEMO4_MAINWINDOW_H
#include "MosquitoWidget.h"
#include <QWidget>
#include <QLabel>
#include <QVBoxLayout>
#include <QFont>


class MainWindow : public QWidget {
Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr) {
        QVBoxLayout *layout = new QVBoxLayout(this);

        scoreLabel = new QLabel("Score: 0", this);
        scoreLabel->setAlignment(Qt::AlignCenter);
        mosquitoWidget = new MosquitoWidget(this);

        layout->addWidget(scoreLabel);
        layout->addWidget(mosquitoWidget);

        connect(mosquitoWidget, &MosquitoWidget::scoreChanged, this, &MainWindow::updateScore);
    }

private slots:
    void updateScore(int newScore) {
        scoreLabel->setText(QString("Score: %1").arg(newScore));
    }
private:
    QLabel *scoreLabel;
    MosquitoWidget *mosquitoWidget;
};


#endif //DAY80_DEMO4_MAINWINDOW_H
